package builder.demo1;

/**
 * 指挥者类，用来管理构建者类的装配顺序
 */
public class Director {
    // 声明 Builder 类型变量
    private ComputerBuilder builder;

    // 有参构造
    public Director(ComputerBuilder builder) {
        this.builder = builder;
    }

    // 组装电脑
    public Computer construct(){
        // 装配各个组件
        builder.builderCpu("因特尔");
        builder.builderGraphics("nvidia");
        builder.builderPower("华为");
        builder.builderMainBoard("华为主板");
        builder.builderMonitor("华为显示器");
        builder.builderDisk("台积电");
        // 提供返回实例
        return builder.buildComputer();
    }
}
